package com.jiukuaidao.zhulin.module.address.model;

import android.content.Context;

import com.jiukuaidao.library.net.IApi;
import com.jiukuaidao.zhulin.entity.ApiHistoryAddressInfo;
import com.jiukuaidao.zhulin.module.address.contract.AddressManagerContract;

import java.util.List;

/**
 * Author : PaiTaSuo
 * Date : 2016/6/17
 * Description :
 */
public class AddressModel implements AddressManagerContract.Model {

    private List<ApiHistoryAddressInfo.AddressInfo> mAddressList;
    private Context mContext;

    public AddressModel(Context context) {
        this.mContext = context;
    }

    @Override
    public List getAddressList() {
        return mAddressList;
    }

    @Override
    public void setAddressList(List list) {
        mAddressList = list;
    }

    @Override
    public void loadData(IApi api) {
        loadData(api, true);
    }

    @Override
    public void loadData(IApi api, boolean isBuildParams) {
        loadData(api, isBuildParams, false);
    }

    @Override
    public void loadData(IApi api, boolean isBuildParams, boolean aes) {
        if (isBuildParams)
            api.buildBaseParams();

        if (aes)
            api.aes();

        api.start();

    }
}
